from flask import Blueprint
from flask_cors import CORS

api = Blueprint("api", __name__)
CORS(api)

from . import elasticsearchapi, user, spark, stat, admin, test, files, pulldata,field

@api.route("/api/definitions", methods=['POST'])
def definitions():
    """
    全局定义definitions
    ---
    definitions:
      table_gather_fields:
        type: object
        properties:
          field_id:
              type: integer
              description: 字段id. 自增
              example: 1
          field_name:
              type: string
              description: 字段名.
              example: keyid
          field_remarks:
              type: string
              description: 字段说明
              example: '数据仓库唯一编号（主键） 维普期刊: keyid = sub_db_id + hash(lngid) 其他类型: keyid = lngid = sub_db_id + hash(rawid) 此字段用于数据仓库内部管理使用，对产品应用不可见'
          field_type:
              type: string
              description: 字段类型.
              example: 文本
          create_time:
              type: string
              description: 创建时间
              example: ‘2021-01-20 06:32:31’
          update_time:
              type: string
              description: 更新时间
              example: ‘2021-01-20 06:32:31’
      table_gather_fields_relation:
        type: object
        properties:
          relation_id:
              type: integer
              description: 字段id. 自增
              example: 1
          source_type:
              type: string
              description: 资源类型
              example: 期刊
          field_id:
              type: integer
              description: 字段id 来自字段表
              example: 1
          index_type:
              type: string
              description: 索引类型，es使用.
              example: keyword
          field_sample:
              type: string
              description: 字段样例
              example: 00002GGKK7787JP169DO0JP1MLR
          order:
              type: integer
              description: 排序号
              example: 1
          field_remarks:
              type: string
              description: 字段说明
              example: '数据仓库唯一编号（主键） 维普期刊: keyid = sub_db_id + hash(lngid) 其他类型: keyid = lngid = sub_db_id + hash(rawid) 此字段用于数据仓库内部管理使用，对产品应用不可见'
          create_time:
              type: string
              description: 创建时间
              example: ‘2021-01-20 06:32:31’
          update_time:
              type: string
              description: 更新时间
              example: ‘2021-01-20 06:32:31’
      update_order:
        type: object
        properties:
          relation_id:
              type: integer
              description: 字段id. 自增
              example: 1
          order:
              type: integer
              description: 排序号
              example: 1
    """